from turtle import *


def prepare(x, y):
    # penup()
    goto(x * N + X, y * N + Y)
    pendown()


setup(500, 500)

X = int(input("Введите координату Х: "))
Y = int(input("Введите координату Y: "))
N = int(input("Введите координату N: "))
penup()
if N == 0 and X >= 0 and X <= 500 and Y >= 0 and Y <= 500:
    pass
elif N > 0 and 0 * N + X >= 0 and 0 * N + Y >= 0 and 20 * N + X <= 500 and 20 * N + Y <= 500:
    pass
elif N < 0 and 20 * N + X >= 0 and 20 * N + Y >= 0 and 0 * N + X <= 500 and 0 * N + Y <= 500:
    pass
else:
    print('Размер фигуры превышает максимальный размер поля')
    exit()

lst = [0, 0, 10, 0, 10, 10, 20, 10, 20, 20, 10, 20, 10, 30, 0, 30, 0, 0]
shape("turtle")
ht()
color('blue')
begin_fill()
for i in range(0, len(lst), 2):
    prepare(lst[i], lst[i + 1])
end_fill()
exitonclick()
